<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../vue/js/jquery.js"></script>
    <script src="../vue/js/vue.js"></script>
</head>
<body>
<div id="app">
    <a href="add.html">新增</a>
    <ul>
        <li v-for="item in employees">
            {{item.id}}--{{item.name}}--{{item.age}}
            <a :href="'detail.html?id='+item.id">编辑</a>
            <button @click="edit(item.id)">删除</button>
        </li>
    </ul>
</div>

<script>
    var vue = new Vue({
        el:'#app',
        data:{
            employees:[]
        },
        methods:{
            edit:function (id) {
                $.get('http://localhost:9000/employee/delete',{id:id},function () {
                    location.href="index.html";
                });
            }
        },
        mounted:function () {

            _this=this
              $.get('http://localhost:9000/employee/list',{},function (data) {
                  console.log(data)
                  vue.employees=data.data;
              });
        }

    })
</script>
</body>
</html>